package com.fbinggun.dt.task;

import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection;

import java.util.ArrayList;
import java.util.List;

public class WorldLimit {
    boolean blacklist;
    List<String> list=new ArrayList<>();

    public WorldLimit(boolean blacklist, List<String> list) {
        this.blacklist = blacklist;
        this.list = list;
    }

    public WorldLimit(ConfigurationSection config) {
        this.blacklist = config.getBoolean("Blacklist");
        this.list = config.getStringList("World");
    }
    public boolean isWorld(World world){
        if(blacklist){
            if(list.contains(world.getName())){
                return false;
            }else {
                return true;
            }
        }else {
            if(list.contains(world.getName())){
                return true;
            }else {
                return false;
            }
        }
    }

}
